namespace HelpDesk.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class TicketStatusAndPriorityUpdateOnTicketModel : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.TicketPriorities",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Priority = c.String(),
                        Color = c.String(),
                        IsActive = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.TicketStatus",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Status = c.String(),
                        Color = c.String(),
                        IsActive = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            AddColumn("dbo.Tickets", "Priority_ID", c => c.Int());
            AddColumn("dbo.Tickets", "Status_ID", c => c.Int());
            AddForeignKey("dbo.Tickets", "Priority_ID", "dbo.TicketPriorities", "ID");
            AddForeignKey("dbo.Tickets", "Status_ID", "dbo.TicketStatus", "ID");
            CreateIndex("dbo.Tickets", "Priority_ID");
            CreateIndex("dbo.Tickets", "Status_ID");
        }
        
        public override void Down()
        {
            DropIndex("dbo.Tickets", new[] { "Status_ID" });
            DropIndex("dbo.Tickets", new[] { "Priority_ID" });
            DropForeignKey("dbo.Tickets", "Status_ID", "dbo.TicketStatus");
            DropForeignKey("dbo.Tickets", "Priority_ID", "dbo.TicketPriorities");
            DropColumn("dbo.Tickets", "Status_ID");
            DropColumn("dbo.Tickets", "Priority_ID");
            DropTable("dbo.TicketStatus");
            DropTable("dbo.TicketPriorities");
        }
    }
}
